/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.iec.edp.caf.msu.api;

import io.iec.edp.caf.msu.api.entity.GspAppServerInstance;
import io.iec.edp.caf.msu.api.entity.GspSuInstance;
import io.iec.edp.caf.msu.api.entity.ServiceUnitInfo;
import io.iec.edp.caf.msu.api.enums.DeployMode;

import java.util.ArrayList;
import java.util.List;

/**
 * MSU服务接口
 *
 * @author Leon Huo
 */
public interface MsuService {

    /**
     * 获取一个AppServer的部署模式
     *
     * @param appServerName appServer名称（注意这里不是指关键应用的app）
     * @return 部署模式
     */
    DeployMode getDeployMode(String appServerName);

    /**
     * 判断一个Su的服务是否本地调用
     *
     * @param serviceUnitName su的名称
     * @return 是否本地调用
     */
    boolean isLocalInvoke(String serviceUnitName);

    /**
     * 获取系统所有启用su信息
     *
     * @return 所有启用su
     */
    List<ServiceUnitInfo> getEnabledServiceUnit();

    //获取一个AppServer的IP(appServer名称（注意这里不是指关键应用的app）)
    @Deprecated
    default String getIpAddress(String appServerName) {
        return "";
    }

    //获取一个appServer的port
    @Deprecated
    default String getPort(String appServerName) {
        return "";
    }

    //获取远程appServerName的baseUrl
    @Deprecated
    default String getRemoteBaseUrl(String appServerName) {
        return "";
    }

    //获取一个AppServer的信息(appServer名称)
    @Deprecated
    default List<GspAppServerInstance> getGspAppServerInfo(String appServerName) {
        return new ArrayList();
    }

    //根据Su名称获取appServer信息
    @Deprecated
    default List<GspAppServerInstance> getGspAppServerInfoBySu(String suName) {
        return new ArrayList<>();
    }

    //获取一个Su的信息
    @Deprecated
    default GspSuInstance getGspSuInfo(String suName) {
        return null;
    }

    //获取一个AppServer下包含的所有的Su
    @Deprecated
    default List<GspSuInstance> getGspSuByAppServer(String appServerName) {
        return new ArrayList<>();
    }

}
